package cc.decat.escript.object;

public class ESNullObject extends ESObject {

    public ESNullObject() {
        super(ESNullType.getInstance());
    }

    @Override
    public boolean equals(Object obj) {
        return this == obj;
    }

    @Override
    public int hashCode() {
        return 0;
    }
}

class ESNullType extends ESType {

    private static final ESNullType instance = new ESNullType();

    public static ESNullType getInstance() {
        return instance;
    }

    private ESNullType() {
        super("NullType");
    }

    @Override
    public ESObject str(ESObject x) {
        return ESStringObject.fromValue("null");
    }
}